/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../mixins/common.less';
@import '../custom.less';
@import './vars.less';

@crop-prefix-cls: ~'@{css-prefix}crop';

.@{crop-prefix-cls} {
  &__wrapper {
    .inject-Crop-vars();
  }

  .cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    -ms-touch-action: none;
    touch-action: none;
    .user-select(none);
  }

  .cropper-container img {
    display: block;
    height: 100%;
    image-orientation: 0deg;
    max-height: none !important;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100%;
  }

  .cropper-wrap-box,
  .cropper-canvas,
  .cropper-drag-box,
  .cropper-crop-box,
  .cropper-modal {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
  }

  .cropper-wrap-box,
  .cropper-canvas {
    overflow: hidden;
  }

  .cropper-drag-box {
    opacity: 0;
  }

  .cropper-modal {
    background-color: var(--tv-Crop-modal-bg-color);
  }

  .cropper-view-box {
    display: block;
    height: 100%;
    overflow: hidden;
    width: 100%;
    outline: none;
  }

  .cropper-dashed {
    border: 0 dashed #eee;
    display: block;
    opacity: 0.5;
    position: absolute;
  }

  .cropper-dashed.dashed-h {
    border-bottom-width: 1px;
    border-top-width: 1px;
    height: 33.3333%;
    left: 0;
    top: 33.3333%;
    width: 100%;
  }

  .cropper-dashed.dashed-v {
    border-left-width: 1px;
    border-right-width: 1px;
    height: 100%;
    left: 33.3333%;
    top: 0;
    width: 33.3333%;
  }

  .cropper-center {
    display: block;
    height: 0;
    left: 50%;
    opacity: 0.75;
    position: absolute;
    top: 50%;
    width: 0;
  }

  // 正中心的+号
  .cropper-center:before,
  .cropper-center:after {
    background-color: var(--tv-Crop-center-bg-color);
    content: ' ';
    display: block;
    position: absolute;
  }

  .cropper-center:before {
    height: 1px;
    left: -3px;
    top: 0;
    width: 7px;
  }

  .cropper-center:after {
    height: 7px;
    left: 0;
    top: -3px;
    width: 1px;
  }

  .cropper-face,
  .cropper-line,
  .cropper-point {
    display: block;
    height: 100%;
    position: absolute;
    width: 100%;
  }

  .cropper-face {
    opacity: 0.1;
    background-color: var(--tv-Crop-face-bg-color);
    left: 0;
    top: 0;
  }

  .cropper-line {
    background-color: #c2c2c2;
    opacity: 1;
  }

  .cropper-line.line-e {
    cursor: ew-resize;
    right: 0;
    top: 0;
    width: 1px;
  }

  .cropper-line.line-n {
    cursor: ns-resize;
    height: 1px;
    left: 0;
    top: 0;
  }

  .cropper-line.line-w {
    cursor: ew-resize;
    left: 0;
    top: 0;
    width: 1px;
  }

  .cropper-line.line-s {
    bottom: 0;
    cursor: ns-resize;
    height: 1px;
    left: 0;
  }

  .cropper-point {
    background-color: #fff;
    height: 10px;
    width: 10px;
    border-radius: 50%;
    border: 1px solid #c2c2c2;
  }

  .cropper-point.point-e {
    cursor: ew-resize;
    margin-top: -3px;
    right: -4px;
    top: 50%;
  }

  .cropper-point.point-n {
    cursor: ns-resize;
    left: 50%;
    margin-left: -3px;
    top: -4px;
  }

  .cropper-point.point-w {
    cursor: ew-resize;
    left: -4px;
    margin-top: -3px;
    top: 50%;
  }

  .cropper-point.point-s {
    bottom: -4px;
    cursor: s-resize;
    left: 50%;
    margin-left: -3px;
  }

  .cropper-point.point-ne {
    cursor: nesw-resize;
    right: -3px;
    top: -3px;
  }

  .cropper-point.point-nw {
    cursor: nwse-resize;
    left: -3px;
    top: -3px;
  }

  .cropper-point.point-sw {
    bottom: -3px;
    cursor: nesw-resize;
    left: -3px;
  }

  .cropper-point.point-se {
    bottom: -3px;
    cursor: nwse-resize;
    right: -3px;
  }

  .cropper-invisible {
    opacity: 0;
  }

  .cropper-bg {
    background-image: url('');
  }

  .cropper-hide {
    display: block;
    height: 0;
    position: absolute;
    width: 0;
  }

  .cropper-hidden {
    display: none !important;
  }

  .cropper-move {
    cursor: move;
  }

  .cropper-crop {
    cursor: crosshair;
  }

  .cropper-disabled .cropper-drag-box,
  .cropper-disabled .cropper-face,
  .cropper-disabled .cropper-line,
  .cropper-disabled .cropper-point {
    cursor: not-allowed;
  }

  .img-container {
    margin: auto;
    overflow: hidden;
  }

  .img-container > img {
    max-width: 100%;
  }

  .crop-modal-warp {
    position: fixed;
    overflow: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    -webkit-overflow-scrolling: touch;
    outline: 0;
  }

  .crop-modal {
    position: relative;
    top: 100px;
    margin: 0 auto 50px;
    background: #fff;
    border-radius: 2px;
    box-sizing: border-box;
    width: 50%;
  }

  input[type='file'] {
    display: none;
  }

  position: fixed;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0;
  left: 0;
  z-index: 1000;
  background: #61616180;

  &__dialog-content__handle {
    display: flex;
    justify-content: center;
    height: 40px;
    margin-top: 12px;
    padding-left: 12px;
    background: var(--tv-Crop-select-bg-color);
    border-radius: 8px;
    box-shadow: var(--tv-Crop-select-box-shadow-color);
  }

  &__dialog-content__handle__button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    // 这里未使用组件前缀
    .iconButton {
      .iconButtonset {
        fill: var(--tv-Crop-select-icon-color);
        height: 24px;
        width: 24px;
        margin-right: 8px;
        padding: 4px;
        cursor: pointer;
        border-radius: 4px;

        &:hover {
          background: var(--tv-Crop-select-icon-color-hover);
        }
      }

      .iconButton__split {
        width: 1px;
        height: 13px;
        margin-right: 8px;
        background-color: var(--tv-Crop-select-box-split-bg-color);
      }
    }
  }

  &__dialog {
    width: 652px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    z-index: 1001;
  }

  &__dialog-cropper {
    width: 652px;
    height: 300px;
    overflow: hidden;
  }
}
